package ${projectPackage}.biz.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.feeling.admin.base.core.CoreContext;
import com.feeling.admin.base.service.impl.BaseTransService;
import com.feeling.admin.common.constants.BankDict;
import ${projectPackage}.dao.${modelName}Dao;
import ${projectPackage}.entity.${modelName};
import ${projectPackage}.model.${modelName}AddForm;
import com.feeling.flbase.common.util.BeanUtil;
import com.feeling.flbase.common.util.IdWorker;

/**
 * @author ${authName}
 * @date ${createDate}
 */
public class ${modelName}AddServiceImpl extends BaseTransService {
	
	@Autowired
	private ${modelName}Dao ${lowModelName}Dao;


	@Override
	public Map<String, ?> prepare(CoreContext context, Map<String, ?> dataMap) {
		return dataMap;
	}


	@Override
	public Map<String, ?> submit(Map<String, ?> request, CoreContext context) {
		Map<String, Object> responseMap=new HashMap<String, Object>();
		${modelName}AddForm addForm=(${modelName}AddForm)context.getData(BankDict.REQUESTFORM);
		${modelName} entity=new ${modelName}();
		BeanUtil.bean2Bean(addForm, entity);
		if (null == entity.get${modelName}Seq()) {
			entity.setDictSeq(IdWorker.getInstance().nextId());
			${lowModelName}Dao.save(entity);
		}else {
			${lowModelName}Dao.update(entity);
		}
		return responseMap;
	}

}
